package com.mapforge.map.tools.undo.tilemapedit;

import com.mapforge.Constants;
import com.mapforge.map.TileMap;

public class ZoomEdit extends AbstractTilemapEdit {
	float oldScale;

	public ZoomEdit(TileMap tilemap, float prevScale) {
		super(tilemap, (tilemap.getScale() > prevScale ? Constants.ZOOM_IN_ICON
				: Constants.ZOOM_OUT_ICON),
				(tilemap.getScale() > prevScale ? "Magnify" : "Demagnify"));
		this.oldScale = prevScale;
	}

	public void undo() {
		float scale = this.getTilemap().getScale();
		this.getTilemap().setScale(oldScale);
		this.oldScale = scale;
	}

	@Override
	public void redo() {
		float scale = this.getTilemap().getScale();
		this.getTilemap().setScale(oldScale);
		this.oldScale = scale;
	}

	@Override
	public void die() {

	}

}
